package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.AgedmallOnlineServiceProductMapper;
import org.linlinjava.litemall.db.domain.AgedmallOnlineServiceProduct;
import org.linlinjava.litemall.db.domain.AgedmallOnlineServiceProductExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author huangfei
 * @create 2021-11-17 10:01
 */
@Service
public class AgedmallOnlineServiceProductService {

    @Resource
    private AgedmallOnlineServiceProductMapper agedmallOnlineServiceProductMapper;

    /**
     * 根据在线服务id查询在线服务规格id
     * @param serviceId
     * @return
     */
    public List<Integer> queryOnLineServiceProductGroupId(Integer serviceId){
        List<Integer> productIdList = new ArrayList<>(15);
         String productId = null; //agedmallOnlineServiceProductMapper.queryOnLineServiceProductGroupId(serviceId);
         if(null == productId){
             return productIdList;
         }
         String proId[] = productId.split(",");
         for(String s : proId){
             productIdList.add(Integer.parseInt(s));
         }
        return productIdList;
    }

    public List<AgedmallOnlineServiceProduct> getProductById(Integer serviceId) {
        AgedmallOnlineServiceProductExample example = new AgedmallOnlineServiceProductExample();
        example.createCriteria().andDeletedEqualTo(false)
                .andOnlineServiceIdEqualTo(serviceId);
        return agedmallOnlineServiceProductMapper.selectByExample(example);
    }
}
